package com.lebang.mapper;

import com.lebang.entity.member.LbbMemberTrade;
import com.lebang.example.LbbMemberTradeExample;
import com.lebang.model.MsgRequest;
import com.lebang.model.statistics.StatisticsRecord;
import com.lebang.model.vo.buss.AppliesListVo;
import com.lebang.model.vo.buss.AppliesSearchVo;
import com.lebang.model.vo.buss.MemberTradeSearchVo;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.Date;
import java.util.List;
@Repository
public interface LbbMemberTradeMapper {
    long countByExample(LbbMemberTradeExample example);

    int deleteByExample(LbbMemberTradeExample example);

    int deleteByPrimaryKey(Long id);

    int insert(LbbMemberTrade record);

    int insertSelective(LbbMemberTrade record);

    List<LbbMemberTrade> selectbyexamplewithblobs(LbbMemberTradeExample example);

    List<LbbMemberTrade> selectByExample(LbbMemberTradeExample example);

    LbbMemberTrade selectByPrimaryKey(Long id);

    int updateByExampleSelective(@Param("record") LbbMemberTrade record, @Param("example") LbbMemberTradeExample example);

    int updatebyexamplewithblobs(@Param("record") LbbMemberTrade record, @Param("example") LbbMemberTradeExample example);

    int updateByExample(@Param("record") LbbMemberTrade record, @Param("example") LbbMemberTradeExample example);

    int updateByPrimaryKeySelective(LbbMemberTrade record);

    int updatebyprimarykeywithblobs(LbbMemberTrade record);

    int updateByPrimaryKey(LbbMemberTrade record);

    LbbMemberTrade getByOrderId(String orderId);
    Integer total(@Param("vo") MemberTradeSearchVo vo);

    List<LbbMemberTrade> pagging(@Param("vo") MemberTradeSearchVo vo);

    Integer totalApplies(@Param("vo") AppliesSearchVo vo, @Param("trade") LbbMemberTrade trade, @Param("phone") String phone);



    Integer totalHistory(@Param("vo") AppliesSearchVo vo);

    List<AppliesListVo> paggingHistory(@Param("vo") AppliesSearchVo vo);

    /**
     * 计算收入/支出
     * @author weizx
     * @date 2018年7月25日 下午8:05:36
     * @param userid
     * @param appid
     * @param category
     * @param sdate
     * @param edate
     * @return
     */
    Integer sum(@Param("userid") String userid, @Param("appid") String appid, @Param("category") String category,
                @Param("type") String type, @Param("sdate") String sdate, @Param("edate") String edate);

    /**
     * 成功的金额
     * @author weizx
     * @date 2018年7月25日 下午9:06:44
     * @param userid
     * @param appid
     * @return
     */
    Integer totalSuccess(@Param("userid") String userid, @Param("appid") String appid, @Param("category") String category,
                         @Param("type") String type);

    Integer selectTradeByMemberId(String memberId);

    Integer selectfirstCash(@Param("str") String str, @Param("memberId") String memberId);

    List<String> selectByMsgRequest(@Param("vo") MsgRequest msgRequest);

    List<String> selectMonthCash(@Param("star") Date star, @Param("end") Date end);

    int sumUserByTime(@Param("appStore") String appStore, @Param("star") LocalDateTime star, @Param("end") LocalDateTime end, @Param("type") int type);

    int sumUserOutLay(@Param("appStore") String appStore, @Param("star") LocalDateTime star, @Param("end") LocalDateTime end, @Param("type") int type);

    BigDecimal todayAllCashMoney(@Param("star") LocalDateTime star, @Param("end") LocalDateTime end);

    int summoney(@Param("memberId")String memberId,@Param("name") String name,@Param("type") String type,@Param("min") LocalDateTime min,@Param("max") LocalDateTime max);

    int checkIncomeById(List<String> memberId);

    Integer OutlaySuccess(@Param("memberId") String memberId, @Param("status") String status);

    BigDecimal todayCreatCashMoney(LocalDateTime star, LocalDateTime end);

    BigDecimal todayWaitCashMoney(LocalDateTime star, LocalDateTime end);

    void updateByMemberId(@Param("memberId") String memberId);

    BigDecimal selectMoneyByTime(@Param("memberId") String memberId,@Param("star") LocalDateTime star,@Param("end") LocalDateTime end);

    List<StatisticsRecord> todayAllCashMoneyAppStore(@Param("star") LocalDateTime star,@Param("end") LocalDateTime end);
}